﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;

using iTextSharp;
using iTextSharp.text;
using iTextSharp.text.pdf;
using iTextSharp.text.pdf.draw;
using iTextSharp.text.pdf.fonts;

namespace PDFCreation
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        

        private void buttonReport_Click(object sender, EventArgs e)
        {
            using (FileStream stream = File.Create("first.pdf"))
            {
                Document document = new Document(PageSize.A4, 10, 10, 10, 10);
                PdfWriter writer = PdfWriter.GetInstance(document, stream);
                document.AddAuthor("Carl Li");
                document.AddSubject("Beginning pdf creation");
                document.AddTitle("My First PDF");

                document.Open();
                Paragraph paragraph = new Paragraph("My first pdf document");
                document.Add(paragraph);
                document.Close();
            }
        }

        private void buttonClose_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
